all:run
GO = /usr/local/go/bin/go
OS := $(shell uname -s)

run:check
	@sudo $(GO) run main.go

build:check
	@sudo $(GO) build main.go

clean:
	rm -f ./dist
	
test:check
	@sudo $(GO) test -count=1 ./tests -v -cover -parallel 4 
#check the operating system is Linux or other Unix-like system
check:
	@OS=$$(uname -s); ARCH=$$(uname -m); \
	if [ "$$OS" = "Darwin" ]; then \
		echo "OS is Mac, but it is not supported"; \
		exit 1; \
	else \
		if [ "$$OS" = "Linux" ]; then \
			echo "OS is Linux"; \
		else \
			echo "OS is not Linux or Mac which is not supported"; \
			exit 1; \
		fi \
	fi
deploy:
	@chmod +x scripts/deploy.sh
	@./scripts/deploy.sh